<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib uri="./WEB-INF/googlemaps.tld" prefix="googlemaps" %>
<googlemaps:map id="map" width="650" height="400" version="2.46" type="STREET" zoom="2">
 	<googlemaps:key domain="http://localhost" key="ABQIAAAAfnthxKxK7MSOAAqStb8Y5BTwM0brOpm-All5BF6PoaKBxRWWERTxNu4lVGKp98JuZGOL24P2S8nAlw" />
 	<googlemaps:point id="point1" latitude="${latitude}" longitude="${longitude}"/>
 	<googlemaps:marker id="marker1" point="point1" draggable="true">
 		<googlemaps:event action="dragend" url="addpub"/>
 	</googlemaps:marker>
	<googlemaps:zoomControl enable="true" size="small"/>
 	<googlemaps:coordinates x="530" y="0" style="font-family:verdana; font-size: 10px; background: #ffffff; border: dashed 1px #000000; padding: 2 0 2 5; opacity: 0.70; filter: alpha(opacity=70);"/>
    <googlemaps:message>
		<img src="./WEB-INF/res/image/loading.gif"/> Please wait...
	</googlemaps:message>
</googlemaps:map>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Add New Pub</title>
</head>
<body onunload="GUnload()">

<googlemaps:scripttag id="map" scope="page" /> 
<googlemaps:javascript id="map" scope="page"/>

<%
if(session.getAttribute("username") != null && session.getAttribute("username") != "") {
%>

<a href="logout.jsp">Logout</a>

<h1>Add New Pub</h1>
<div><a href="http://localhost:8080/Pub2SearchAdmin/browse.jsp">Back to the List</a>
&nbsp;<div style="color:green">${dbmessage}</div></div>

<form name="addform" action="addpub" method="post">
<table>
<tr>
	<td colspan="2">
	<googlemaps:div id="map"/> 
	<googlemaps:initialize id="map"/><br />
	(Please specify the location of the pub first before completing the form!)
	<input type="hidden" name="txt_latitude" value="${latitude}" />
	<input type="hidden" name="txt_longitude" value="${longitude}" />
	</td>
</tr>
<tr>
	<td>Name:</td><td><input name="txt_name" size="40" /></td>		
</tr>
<tr>
	<td>Address:</td><td><input name="txt_address" size="40" /></td>
</tr>
<tr>
	<td>Open Hour:</td>
	<td>
	<select name="txt_openhour">	
		<option value="0">00</option>
		<option value="1">01</option>
		<option value="2">02</option>
		<option value="3">03</option>
		<option value="4">04</option>
		<option value="5">05</option>
		<option value="6">06</option>
		<option value="7">07</option>
		<option value="8">08</option>
		<option value="9" selected>09</option>
		<option value="10">10</option>
		<option value="11">11</option>
		<option value="12">12</option>
		<option value="13">13</option>
		<option value="14">14</option>
		<option value="15">15</option>
		<option value="16">16</option>
		<option value="17">17</option>
		<option value="18">18</option>
		<option value="19">19</option>
		<option value="20">20</option>
		<option value="21">21</option>
		<option value="22">22</option>
		<option value="23">23</option>
	</select>&nbsp;:&nbsp;
	<select name="txt_openminute">	
		<option value="0">00</option>
		<option value="30">30</option>
	</select></td>
</tr>
<tr>
	<td>Close Hour:</td>
	<td><select name="txt_closehour">	
		<option value="24">00</option>
		<option value="1" selected>01</option>
		<option value="2">02</option>
		<option value="3">03</option>
		<option value="4">04</option>
		<option value="5">05</option>
		<option value="6">06</option>
		<option value="7">07</option>
		<option value="8">08</option>
		<option value="9">09</option>
		<option value="10">10</option>
		<option value="11">11</option>
		<option value="12">12</option>
		<option value="13">13</option>
		<option value="14">14</option>
		<option value="15">15</option>
		<option value="16">16</option>
		<option value="17">17</option>
		<option value="18">18</option>
		<option value="19">19</option>
		<option value="20">20</option>
		<option value="21">21</option>
		<option value="22">22</option>
		<option value="23">23</option>
	</select>&nbsp;:&nbsp;
	<select name="txt_closeminute">	
		<option value="0">00</option>
		<option value="30">30</option>
	</select></td>
</tr>
<tr>
	<td>Description:</td><td><textarea rows="5" cols="40" name="txt_description"></textarea></td>
</tr>
<tr>
    <td>Facility:</td>
    <td>
    <input type="checkbox" name="opt_beer" value="Beer">Beer<br />
	<input type="checkbox" name="opt_livemusic" value="Live music">Live music<br />
	<input type="checkbox" name="opt_dancefloor" value="Dance floor">Dance floor<br />
	<input type="checkbox" name="opt_nosmoking" value="No smoking">No smoking<br />
    </td>
</tr>
<tr>
	<td colspan="2"><input value="Add new!" type="submit" />&nbsp;<input value="Clear form" type="reset" /></td>
</tr>
</table>
</form>

<%
}
else {
	out.println("<h1>Session expired!</h1>");
	out.println("<a href='http://localhost:8080/Pub2SearchAdmin/login.jsp'>Go to login page</a>");
}
%>

</body>
</html>